#include <iostream>

using namespace std;

const int N = 110;
char a[N][N];
bool st[N][N];
int n, num[200];
int dx[] = { 1, 0, 1 };
int dy[] = { 0, 1, 1 };
// yizhong
bool dfs(int i, int j, int dir)
{
	if (i > n || j > n)
	{
		if (num['y'] == 1 && num['i'] == 1
			&& num['z'] == 1 && num['o'] == 1
			&& num['h'] == 1 && num['g'] == 1
			&& num['n'] == 1)
			return true;
			else return false;
	}
	int x = i + dx[dir];
	int y = j + dy[dir];
	int flag = 0;
	num[a[i][j]]++;
	if (dfs(x, y, dir) && (a[i][j] == 'y' || a[i][j] == 'i'
		|| a[i][j] == 'z' || a[i][j] == 'h' || a[i][j] == 'o' || a[i][j] == 'n'
		|| a[i][j] == 'g'))
	{
		st[i][j] = true;
		flag = 1;
	}
	num[a[i][j]]--;
	if (flag) return true;
	return false;
}

int main()
{
	cin >> n;
	for (int i = 1; i <= n; i++)
	{
		scanf("%c", &a[0][0]);
		for (int j = 1; j <= n; j++)
		{
			scanf("%c", &a[i][j]);
		}
	}
	for (int i = 1; i <= n; i++)
	{
		dfs(1, i, 0);
		dfs(1, i, 1);
		dfs(1, i, 2);
	} 
	for (int i = 1; i <= n; i++)
	{
		for (int j = 1; j <= n; j++)
		{
			if (st[i][j]) cout << a[i][j];
			else cout << '*';
		}
		cout << endl;
	}
	return 0;
}
